import 'package:flutter/material.dart';
import '../style/color.dart';

// 通用图标封装类
class CommonIcon extends StatelessWidget {
  CommonIcon(this.iconData,
      {this.height,
      this.margin,
      this.onIconTap,
      this.padding,
      this.iconColor = lightGrayTextColor});

  final EdgeInsetsGeometry padding;
  final EdgeInsetsGeometry margin;
  final double height;
  final VoidCallback onIconTap; // 点击图标触发的事件
  final IconData iconData;
  final Color iconColor;
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
        onTap: onIconTap,
        behavior: HitTestBehavior.opaque,
        child: Container(
          margin: margin,
          padding: padding,
          child: Icon(iconData, color: iconColor),
        ));
  }
}
